#ifndef _edaSequentialControl_h_
#define _edaSequentialControl_h_

#include <map>
#include <vector>

using namespace std;

#include "edaSearch.h"
#include "edaDAG.h"

// Define the status code
#define STATUS_PENDING 0
#define STATUS_RUNNING 1
#define STATUS_FINISHED 2
#define STATUS_ERROR 3

class edaSequentialControl
{
  public:
    edaSequentialControl();
    int insertVertex(edaSearch *sa);
    int insertEdge(const int from, const int to);
    bool search(edaSolution &sol);

  private:
    vector<int> findReadyNodes() const;
    bool allDone() const;

    edaDAG<edaSearch*> taskDAG;
    int edgeNum;
    map<int, int> taskStatus;
    int vertexNum;
};

#endif
